package dao.pojo;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "test", catalog = "makeiteasy")
public class Test implements java.io.Serializable {

	// Fields
	private static final long serialVersionUID = 1L;
	private Integer testId;
	private Listen listen;
	private Rewrite rewrite;
	private Reading reading;
	private Teacher teacher;
	private Translate translate;
	private Selection selection;
	private Writing writing;
	private String testName;
	private String listenUrl;
	private String listenUrlFileName;
	private Timestamp testCreateDate;
	private Set<Score> scores = new HashSet<Score>(0);
	private Set<Exam> exams = new HashSet<Exam>(0);
	private Set<Quiz> quizs = new HashSet<Quiz>(0);

	// Constructors

	/** default constructor */
	public Test() {
	}

	/** full constructor */
	public Test(Listen listen, Rewrite rewrite, Reading reading,
			Teacher teacher, Translate translate, Selection selection,
			Writing writing, String testName, String listenUrl,
			Timestamp testCreateDate, Set<Score> scores, String listenUrlFileName,
			Set<Exam> exams, Set<Quiz> quizs) {
		this.listen = listen;
		this.rewrite = rewrite;
		this.reading = reading;
		this.teacher = teacher;
		this.translate = translate;
		this.selection = selection;
		this.writing = writing;
		this.testName = testName;
		this.listenUrl = listenUrl;
		this.listenUrlFileName = listenUrlFileName;
		this.testCreateDate = testCreateDate;
		this.scores = scores;
		this.exams = exams;
		this.quizs = quizs;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "testId", unique = true, nullable = false)
	public Integer getTestId() {
		return this.testId;
	}

	public void setTestId(Integer testId) {
		this.testId = testId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "listenId")
	public Listen getListen() {
		return this.listen;
	}

	public void setListen(Listen listen) {
		this.listen = listen;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "rewriteId")
	public Rewrite getRewrite() {
		return this.rewrite;
	}

	public void setRewrite(Rewrite rewrite) {
		this.rewrite = rewrite;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "readId")
	public Reading getReading() {
		return this.reading;
	}

	public void setReading(Reading reading) {
		this.reading = reading;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "teaId")
	public Teacher getTeacher() {
		return this.teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "translateId")
	public Translate getTranslate() {
		return this.translate;
	}

	public void setTranslate(Translate translate) {
		this.translate = translate;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "selectionId")
	public Selection getSelection() {
		return this.selection;
	}

	public void setSelection(Selection selection) {
		this.selection = selection;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "writeId")
	public Writing getWriting() {
		return this.writing;
	}

	public void setWriting(Writing writing) {
		this.writing = writing;
	}

	@Column(name = "testName", length = 100)
	public String getTestName() {
		return this.testName;
	}

	public void setTestName(String testName) {
		this.testName = testName;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "test")
	public Set<Score> getScores() {
		return this.scores;
	}

	public void setScores(Set<Score> scores) {
		this.scores = scores;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "test")
	public Set<Exam> getExams() {
		return this.exams;
	}

	public void setExams(Set<Exam> exams) {
		this.exams = exams;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "test")
	public Set<Quiz> getQuizs() {
		return this.quizs;
	}

	public void setQuizs(Set<Quiz> quizs) {
		this.quizs = quizs;
	}
	
	@Column(name = "listenURL", length = 128)
	public String getListenUrl() {
		return this.listenUrl;
	}

	public void setListenUrl(String listenUrl) {
		this.listenUrl = listenUrl;
	}
	
	@Column(name = "listenUrlFileName", length = 128)
	public String getListenUrlFileName() {
		return listenUrlFileName;
	}
	
	public void setListenUrlFileName(String listenUrlFileName) {
		this.listenUrlFileName = listenUrlFileName;
	}
	
	@Column(name = "testCreateDate", length = 19)
	public Timestamp getTestCreateDate() {
		return testCreateDate;
	}
	
	public void setTestCreateDate(Timestamp testCreateDate) {
		this.testCreateDate = testCreateDate;
	}
}